<template>
    <!-- 修改资料 -->

    <div>
        <!-- 内容主题区域 -->
        <el-form label-width="125px" :model="form" label-position="right" ref="formRef" :disabled="disabled"
            :class="{ 'borderNone': disabled }">
            <el-card>
                <el-row>
                    <el-col :xs="24" :sm="8" :md="8" :lg="8" :xl="8">
                        <el-form-item label="材料库存" prop="stuffStock">
                            <el-select v-if="!disabled" v-model="form.stuffStock" clearable placeholder="请选择：">
                                <el-option v-for="item in configData.stuffStockList" :key="item.value" :label="item.label"
                                    :value="item.value">
                                </el-option>
                            </el-select>
                            <el-input v-else v-model="form.stuffStockName"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="8" :md="8" :lg="8" :xl="8">
                        <el-form-item label="托外生产" prop="assistProduce">
                            <el-radio-group v-model="form.assistProduce" style="margin-top: -4px;">
                                <template v-for="(item, index) in configData.needList" :key="index">
                                    <el-radio :label="item.value" size="large">{{ item.label }}</el-radio>
                                </template>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col v-if="form.assistProduce == '1'" :xs="24" :sm="8" :md="8" :lg="8" :xl="8">
                        <el-form-item label="托外生产厂商" prop="assistSupplier">
                            <sc-table-select v-if="!disabled" v-model="assistSupplierRows"  :apiObj="apiObj"
                                :fileName="assistSupplierFileName" :table-width="700" :props="tableProps" @change="assistSupplierChange" injectionKey="outsourcedFactory">
                            </sc-table-select>
                            <el-input v-else v-model="form.assistSupplier"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :xs="24" :sm="8" :md="8" :lg="8" :xl="8">
                        <el-form-item label="试生产" prop="testProduce">
                            <el-radio-group v-model="form.testProduce" style="margin-top: -4px;">
                                <template v-for="(item, index) in configData.yesNoList" :key="index">
                                    <el-radio :label="item.value" size="large">{{ item.label }}</el-radio>
                                </template>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="8" :md="8" :lg="8" :xl="8">
                        <el-form-item prop="technologyAbility">
                            <template #label>
                                <span v-if="!disabled" style="color: #f56c6c;margin-right: 4px;">*</span>
                                <span style="display:inline-block;">工艺及设备能力</span>
                            </template>
                            <el-radio-group v-model="form.technologyAbility" style="margin-top: -4px;">
                                <template v-for="(item, index) in configData.satisfiedList" :key="index">
                                    <el-radio :label="item.value" size="large">{{ item.label }}</el-radio>
                                </template>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="8" :md="8" :lg="8" :xl="8">
                        <el-form-item label="生产能力" prop="produceAbility">
                            <el-radio-group v-model="form.produceAbility" style="margin-top: -4px;">
                                <template v-for="(item, index) in configData.satisfiedList" :key="index">
                                    <el-radio :label="item.value" size="large">{{ item.label }}</el-radio>
                                </template>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :xs="24" :sm="8" :md="8" :lg="8" :xl="8">
                        <el-form-item label="新开模具" prop="newCreateMold">
                            <el-select v-if="!disabled" v-model="form.newCreateMold" clearable placeholder="请选择：">
                                <el-option v-for="item in configData.newCreateMoldList" :key="item.value"
                                    :label="item.label" :value="item.value">
                                </el-option>
                            </el-select>
                            <el-input v-else v-model="form.newCreateMoldName"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="8" :md="8" :lg="8" :xl="8">
                        <el-form-item label="量产可行性" prop="batchProductAbality">
                            <el-radio-group v-model="form.batchProductAbality" style="margin-top: -4px;">
                                <template v-for="(item, index) in configData.batchProductAbalityList" :key="index">
                                    <el-radio :label="item.value" size="large">{{ item.label }}</el-radio>
                                </template>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                </el-row>

                <el-row :gutter="5">
                    <el-form-item label="炭刷纳期">
                        1.
                        <el-col :xs="24" :sm="7" :md="7" :lg="7" :xl="7">
                            <el-date-picker  v-model="form.brushNaperiod1" type="date"
                                value-format="YYYY-MM-DD" placeholder="请选择日期" />
                            <!-- <el-input v-else style="width: 200%;" v-model="form.brushNaperiod1"></el-input> -->
                        </el-col>
                    </el-form-item>
                    <el-form-item>
                        2.
                        <el-col :xs="24" :sm="7" :md="7" :lg="7" :xl="7">
                            <el-date-picker  v-model="form.brushNaperiod2" type="date"
                                value-format="YYYY-MM-DD" placeholder="请选择日期" />
                            <!-- <el-input v-else style="width: 200%;" v-model="form.brushNaperiod2"></el-input> -->
                        </el-col>
                    </el-form-item>
                    <el-form-item>
                        3.
                        <el-col :xs="24" :sm="7" :md="7" :lg="7" :xl="7">
                            <el-date-picker  v-model="form.brushNaperiod3" type="date"
                                value-format="YYYY-MM-DD" placeholder="请选择日期" />
                            <!-- <el-input v-else style="width: 200%;" v-model="form.brushNaperiod3"></el-input> -->
                        </el-col>
                    </el-form-item>
                </el-row>
                <el-row :gutter="5">
                    <el-form-item label="材料纳期" prop="stuffNaperiod">
                        1.
                        <el-col :xs="24" :sm="11" :md="11" :lg="11" :xl="11">
                            <el-date-picker  v-model="form.stuffNaperiod" type="date"
                                value-format="YYYY-MM-DD" placeholder="请选择日期" />
                            <!-- <el-input v-else style="width: 200%;" v-model="form.stuffNaperiod"></el-input> -->
                        </el-col>
                    </el-form-item>
                    <el-form-item>
                        2.
                        <el-col :xs="24" :sm="11" :md="11" :lg="11" :xl="11">
                            <el-date-picker  v-model="form.stuffNaperiod2" type="date"
                                value-format="YYYY-MM-DD" placeholder="请选择日期" />
                            <!-- <el-input v-else style="width: 200%;" v-model="form.stuffNaperiod2"></el-input> -->
                        </el-col>
                    </el-form-item>
                </el-row>
                <el-row :gutter="5">
                    <el-form-item label="组件纳期" prop="componentsNaperiod1">
                        1.
                        <el-col :xs="24" :sm="7" :md="7" :lg="7" :xl="7">
                            <el-date-picker  v-model="form.componentsNaperiod1" type="date"
                                value-format="YYYY-MM-DD" placeholder="请选择日期" />
                            <!-- <el-input v-else style="width: 200%;" v-model="form.componentsNaperiod1"></el-input> -->
                        </el-col>
                    </el-form-item>
                    <el-form-item prop="componentsNaperiod2">
                        2.
                        <el-col :xs="24" :sm="7" :md="7" :lg="7" :xl="7">
                            <el-date-picker  v-model="form.componentsNaperiod2" type="date"
                                value-format="YYYY-MM-DD" placeholder="请选择日期" />
                            <!-- <el-input v-else style="width: 200%;" v-model="form.componentsNaperiod2"></el-input> -->
                        </el-col>
                    </el-form-item>
                    <el-form-item prop="componentsNaperiod3">
                        3.
                        <el-col :xs="24" :sm="7" :md="7" :lg="7" :xl="7">
                            <el-date-picker  v-model="form.componentsNaperiod3" type="date"
                                value-format="YYYY-MM-DD" placeholder="请选择日期" />
                            <!-- <el-input v-else style="width: 200%;" v-model="form.componentsNaperiod3"></el-input> -->
                        </el-col>
                    </el-form-item>
                </el-row>
                <el-row :gutter="5">
                    <el-form-item label="刷架单件预计" prop="frameNaperiod1">
                        1.
                        <el-col :xs="24" :sm="7" :md="7" :lg="7" :xl="7">
                            <el-date-picker  v-model="form.frameNaperiod1" type="date"
                                value-format="YYYY-MM-DD" placeholder="请选择日期" />
                            <!-- <el-input v-else style="width: 200%;" v-model="form.frameNaperiod1"></el-input> -->
                        </el-col>
                    </el-form-item>
                    <el-form-item>
                        2.
                        <el-col :xs="24" :sm="7" :md="7" :lg="7" :xl="7">
                            <el-date-picker  v-model="form.frameNaperiod2" type="date"
                                value-format="YYYY-MM-DD" placeholder="请选择日期" />
                            <!-- <el-input v-else style="width: 200%;" v-model="form.frameNaperiod2"></el-input> -->
                        </el-col>
                    </el-form-item>
                    <el-form-item>
                        3.
                        <el-col :xs="24" :sm="7" :md="7" :lg="7" :xl="7">
                            <el-date-picker  v-model="form.frameNaperiod3" type="date"
                                value-format="YYYY-MM-DD" placeholder="请选择日期" />
                            <!-- <el-input v-else style="width: 200%;" v-model="form.frameNaperiod3"></el-input> -->
                        </el-col>
                    </el-form-item>
                </el-row>
                <el-row>
                    <el-col :sm="8" :md="8" :lg="8" :xl="8">
                        <el-form-item label="铜套预计" prop="copperNaperiod">
                            <el-date-picker v-if="!disabled" v-model="form.copperNaperiod" type="date"
                                value-format="YYYY-MM-DD" placeholder="请选择日期" />
                            <el-input v-else v-model="form.copperNaperiod"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :sm="8" :md="8" :lg="8" :xl="8">
                        <el-form-item label="弹簧预计" prop="springNaperiod">
                            <el-date-picker v-if="!disabled" v-model="form.springNaperiod" type="date"
                                value-format="YYYY-MM-DD" placeholder="请选择日期" />
                            <el-input v-else v-model="form.springNaperiod"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :sm="8" :md="8" :lg="8" :xl="8">
                        <el-form-item label="端子预计" prop="terminalNaperiod">
                            <el-date-picker v-if="!disabled" v-model="form.terminalNaperiod" type="date"
                                value-format="YYYY-MM-DD" placeholder="请选择日期" />
                            <el-input v-else v-model="form.terminalNaperiod"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :sm="8" :md="8" :lg="8" :xl="8">
                        <el-form-item label="检验工装纳期" prop="checkWorkToolNaperiod">
                            <el-date-picker v-if="!disabled" v-model="form.checkWorkToolNaperiod" type="date"
                                value-format="YYYY-MM-DD" placeholder="请选择日期" />
                            <el-input v-else v-model="form.checkWorkToolNaperiod"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :sm="8" :md="8" :lg="8" :xl="8">
                        <el-form-item label="检具纳期" prop="checkToolNaperiod">
                            <el-date-picker v-if="!disabled" v-model="form.checkToolNaperiod" type="date"
                                value-format="YYYY-MM-DD" placeholder="请选择日期" />
                            <el-input v-else v-model="form.checkToolNaperiod"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :sm="8" :md="8" :lg="8" :xl="8">
                        <el-form-item label="镀铜纳期" prop="duCopperNaperiod">
                            <el-date-picker v-if="!disabled" v-model="form.duCopperNaperiod" type="date"
                                value-format="YYYY-MM-DD" placeholder="请选择日期" />
                            <el-input v-else v-model="form.duCopperNaperiod"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :xs="24" :sm="8" :md="8" :lg="8" :xl="8">
                        <el-form-item prop="needWheel">
                            <template #label>
                                <span v-if="!disabled" style="color: #f56c6c;margin-right: 4px;">*</span>
                                <span style="display:inline-block;">砂轮</span>
                            </template>
                            <el-radio-group v-model="form.needWheel" style="margin-top: -4px;">
                                <template v-for="(item, index) in configData.needList" :key="index">
                                    <el-radio :label="item.value" size="large">{{ item.label }}</el-radio>
                                </template>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col v-if="form.needWheel == '1'" :xs="24" :sm="8" :md="8" :lg="8" :xl="8">
                        <el-form-item label="有无" prop="grindingWheel">
                            <el-radio-group v-model="form.grindingWheel" style="margin-top: -4px;">
                                <template v-for="(item, index) in configData.haveNoList" :key="index">
                                    <el-radio :label="item.value" size="large">{{ item.label }}</el-radio>
                                </template>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col v-if="form.needWheel == '1' && form.grindingWheel == '0'" :xs="24" :sm="8" :md="8" :lg="8"
                        :xl="8">
                        <el-form-item label="砂轮何时到货" prop="whenArrival">
                            <el-date-picker v-if="!disabled" v-model="form.whenArrival" type="date"
                                value-format="YYYY-MM-DD" placeholder="请选择日期" />
                            <el-input v-else v-model="form.whenArrival"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :xs="24" :sm="8" :md="8" :lg="8" :xl="8">
                        <el-form-item prop="needTooling">
                            <template #label>
                                <span v-if="!disabled" style="color: #f56c6c;margin-right: 4px;">*</span>
                                <span style="display:inline-block;">工装是否需要</span>
                            </template>
                            <el-radio-group v-model="form.needTooling" style="margin-top: -4px;">
                                <template v-for="(item, index) in configData.needList" :key="index">
                                    <el-radio :label="item.value" size="large">{{ item.label }}</el-radio>
                                </template>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col v-if="form.needTooling == '1'" :xs="24" :sm="8" :md="8" :lg="8" :xl="8">
                        <el-form-item label="有无" prop="toolHaveOrNo">
                            <el-radio-group v-model="form.toolHaveOrNo" style="margin-top: -4px;">
                                <template v-for="(item, index) in configData.haveNoList" :key="index">
                                    <el-radio :label="item.value" size="large">{{ item.label }}</el-radio>
                                </template>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col v-if="form.needTooling == '1' && form.toolHaveOrNo == '0'" :xs="24" :sm="8" :md="8" :lg="8"
                        :xl="8">
                        <el-form-item label="砂轮何时到货" prop="toolWhenArrival">
                            <el-date-picker v-if="!disabled" v-model="form.toolWhenArrival" type="date"
                                value-format="YYYY-MM-DD" placeholder="请选择日期" />
                            <el-input v-else v-model="form.toolWhenArrival"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :sm="8" :md="8" :lg="8" :xl="8">
                        <el-form-item label="外协确认" prop="assistResult">
                            <el-radio-group v-model="form.assistResult" style="margin-top: -4px;">
                                <template v-for="(item, index) in configData.feasibilityList" :key="index">
                                    <el-radio :label="item.value" size="large">{{ item.label }}</el-radio>
                                </template>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col :sm="8" :md="8" :lg="8" :xl="8">
                        <el-form-item label="物流资材确认" prop="logisticsResult">
                            <el-radio-group v-model="form.logisticsResult" style="margin-top: -4px;">
                                <template v-for="(item, index) in configData.feasibilityList" :key="index">
                                    <el-radio :label="item.value" size="large">{{ item.label }}</el-radio>
                                </template>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col :sm="8" :md="8" :lg="8" :xl="8">
                        <el-form-item label="设备确认" prop="deviceResult">
                            <el-radio-group v-model="form.deviceResult" style="margin-top: -4px;">
                                <template v-for="(item, index) in configData.feasibilityList" :key="index">
                                    <el-radio :label="item.value" size="large">{{ item.label }}</el-radio>
                                </template>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-card>
        </el-form>
    </div>
</template>

<script setup>
import { ref, onMounted, watch } from 'vue';
import { ElNotification } from 'element-plus';
import Api from '@/api/model/sample'
import sysApi from '@/api/model/system'
const emit = defineEmits(['update:modelValue'])
const props = defineProps({
    modelValue: { type: Object, default: () => { } },
    disabled: { type: Boolean, default: false },
    configData: { type: Object, default: () => { } }
})
const form = ref({})
const apiObj = ref(sysApi.select.query)
const assistSupplierRows = ref({})
const assistSupplierFileName = ref('ChooseErpCustReport')
const tableProps = {
    label: 'name',
    value: 'name',
}
onMounted(() => {
    form.value = props.modelValue
    assistSupplierRows.value = {
        name:form.value.assistSupplier,
        name:form.value.assistSupplier
    }

})
const assistSupplierChange = (val) => {
    form.value.assistSupplier = val.name
}

</script>

<style lang="less" scoped>
.borderNone {
    :deep(.el-input__wrapper) {
        box-shadow: 0 0 0 0px var(--el-input-border-color, var(--el-border-color)) inset;
        cursor: default;
        background-color: transparent; //背景颜色透明
        border-bottom: 1px solid #999;
        border-radius: 0;

        .el-input__inner {
            cursor: default !important;
        }
    }
}
</style>

